package com.micro.school.order.service.impl;

import com.micro.school.common.core.domain.R;
import com.micro.school.order.service.ICollegeService;
import com.micro.school.system.api.RemoteEduService;
import com.micro.school.system.api.domain.vo.SchoolCollegeVos;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 *根据学院查询校区
 */
@Service
public class CollegeServiceImpl implements ICollegeService
{
    @Autowired
    private RemoteEduService remoteEduService;

    @Override
    public Long getCampusIdByCollegeId(Long collegeId) {
        if(null==collegeId){
            return null;
        }
        R<SchoolCollegeVos> collegeR = remoteEduService.getCollegeById(collegeId);
        if(null==collegeR || null==collegeR.getData()){
            return null;
        }
        SchoolCollegeVos collegeVos = collegeR.getData();
        if(null==collegeVos || null==collegeVos.getCollegeName()){
            return null;
        }
        return collegeVos.getCampusId();
    }
}
